*****************************************************************
*********** Mining and violent competition in Africa ************
****** A.S. Rigterink, T. Ghani, J.S. Lozano, J.N. Shapiro ******
************************** Master do-file ***********************

/*
0. Installing packages, setting globals
1. Do-files running analyses
2. Do-files creating tables0. Setting globals
*/
*****************************************************************

clear all
version 17.0
set more off
cap log close

/*-----------------------------------------------------
------- 0. Installing packages, setting globals -------
-------------------------------------------------------*/

*** Directory globals
*** NB: SET YOUR DIRECTORY HERE 
global dir = ".\Replication_data\Stata"

cd "$dir"

*** Subdirectories
global Do_files     "./Do"
global Data			"./Data"
global Results		"./Results"
global Tables 		"./Tables"

*** Packages
ssc install reghdfe 
ssc install reg2hdfe
ssc install texsave


/*-----------------------------------------------------
------- 1. Running do-files running analyses ----------
-------------------------------------------------------*/

do "$Do_files/Main_Table_2.do"
do "$Do_files/Main_Table_3_4_5.do"
do "$Do_files/Appendix_Table_A1-4.do"
do "$Do_files/Appendix_Figure_A3-4.do"
do "$Do_files/Appendix_Figure_A9.do"
do "$Do_files/Appendix_Table_B3.do"
do "$Do_files/Appendix_Section_C.do"
do "$Do_files/Appendix_Section_D.do"

/*----------------------------------------------------
--- 2. Running do-file creating tables and figures ---
------------------------------------------------------*/

do "$Do_files/All_Tables_Figures_Generate.do"